package com.zlkj.ssm.shop.web.tools;

import javax.servlet.http.HttpSession;

import com.zlkj.ssm.shop.core.FrontContainer;
import com.zlkj.ssm.shop.core.ManageContainer;
import com.zlkj.ssm.shop.core.entity.User;
import com.zlkj.ssm.shop.front.entity.Account;

/**
 * 登录用户获取
 */
public class LoginUserHolder {
	/**
	 * 从session中获取后台用户
	 * 
	 * @return User
	 */
	public static User getLoginUser() {
		HttpSession session = RequestHolder.getSession();
		return session == null ? null : (User) session.getAttribute(ManageContainer.manage_session_user_info);
	}

	/**
	 * 从session中获取登录会员
	 * 
	 * @return Account
	 */
	public static Account getLoginAccount() {
		HttpSession session = RequestHolder.getSession();
		return session == null ? null : (Account) session.getAttribute(FrontContainer.USER_INFO);
	}
}
